<template>
  <div>
    <!-- 我的毕设课题 -->
    <el-descriptions :column="2" border>
      <el-descriptions-item>
        <template slot="label"> 课题 </template>
        {{ list.topic_name }}
      </el-descriptions-item>
      <!-- <el-descriptions-item>
        <template slot="label"> 指导教师 </template>
        {{ list.teacher_name }}
      </el-descriptions-item> -->
      <el-descriptions-item>
        <template slot="label"> 可带学生数量 </template>
        {{ list.allow_num }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label"> 课题来源 </template>
        {{ list.topic_from }}
      </el-descriptions-item>
      <!-- <el-descriptions-item>
        <template slot="label"> 选题模式 </template>
        {{ list.topic_choose }}
      </el-descriptions-item> -->
      <el-descriptions-item>
        <template slot="label"> 课题类型 </template>
        {{ list.topic_type }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label"> 课题难易程度 </template>
        {{ list.topic_degree }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label"> 课题工作量 </template>
        {{ list.topic_work }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          课题所需条件是否具备
        </template>
        {{ list.topic_is }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          课题内容介绍
        </template>
        {{ list.topic_content }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          毕业设计(论文)要求
        </template>
        {{ list.paper_requirement }}
      </el-descriptions-item>
    </el-descriptions>

    <el-button @click="goback">返回上一级</el-button>
  </div>
</template>
<script>
export default {
  created() {
    this.getTopic();
  },
  data() {
    return {
      list: [],
    };
  },
  methods: {
    getTopic() {
      this.$http.get("http://127.0.0.1:8080/my/getTopic").then((res) => {
        res.data.data[0].forEach((val) => {
          // console.log(val.teacher_name);
          res.data.data[1].forEach((value) => {
            // console.log(value);
            if (val.teacher_num == value.teacher_id) {
              Object.assign(value, { teacher_name: val.teacher_name });
            }
          });
        });
        this.list = res.data.data[1][0];
        // console.log(this.list[0]);
      });
    },
    goback() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang="less" scoped>
.el-button {
  float: right;
  margin: 20px 0;
}
</style>
